package com.team.service.Impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.team.dao.impl.EquipmentDaoImpl;
import com.team.dao.impl.EquipmentStockDaoImpl;
import com.team.entity.Equipment;
import com.team.entity.EquipmentStock;
import com.team.service.EquipmentService;

@Service
@Transactional
public class EquipmentServiceImpl implements EquipmentService {
	@Resource
	private EquipmentDaoImpl el;
	@Resource
	private EquipmentStockDaoImpl esl;

	public Equipment selectEquipmentById(int id) {
		Equipment equipment = el.selectEquipmentById(id);
		return equipment;
	}

	public void addEquipment(Equipment equipment) {
		el.saveEquipment(equipment);
		esl.updateEquipmentsubStock(equipment);

	}

	public void deleteEquipment(Integer id) {
		el.deleteEquipment(id);

	}

	public void updateEquipment(Equipment equipment) {
		el.updateEquipment(equipment);

	}

	public List<Equipment> selectAllEquipment(int pagenumber) {
		List<Equipment> list = el.selectAllEquipment(pagenumber);
		return list;
	}

}
